package com.ruoyi.system.api;

import com.ruoyi.system.api.domain.dto.OssUrlDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.SysFile;
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;

/**
 * 文件服务
 *
 * @author ruoyi
 */
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteFileService {
    /**
     * 上传文件
     *
     * @param file 文件信息
     * @return 结果
     */
    @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);

    /**
     * 上传文件
     *
     * @param file 文件信息
     * @return 结果
     */
    @PostMapping(value = "/system/oss/uploadOss", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public R<Object> uploadOss(@RequestPart(value = "file") MultipartFile file);

    /**
     * 上传文件
     *
     * @param dto 网址
     * @return 结果
     */
    @PostMapping(value = "/system/oss/uploadUrl")
    public R<Object> uploadUrl(@RequestBody OssUrlDto dto);

    /**
     * 删除oss图片
     *
     * @param url
     * @return
     */
    @GetMapping(value = "/system/oss/delALiYunPic")
    public R<Object> delALiYunPic(String url);

    /**
     * 删除oss图片
     *
     * @param
     * @return
     */
    @GetMapping(value = "/system/oss/getOssUrlHeader")
    public R<Object> getOssUrlHeader();


}
